package org.test.cloud.stream.rocketmq.util;

import org.springframework.cloud.stream.binder.PartitionSelectorStrategy;
import org.springframework.stereotype.Component;

@Component
public class ExampleKeySelector implements PartitionSelectorStrategy {

    @Override
    public int selectPartition(Object key, int partitionCount) {
        if (key instanceof Integer i) {
            System.out.println(key);
            System.out.println(partitionCount);
            return i % partitionCount;
        } else {
            return 0;
        }
    }
}
